/**
 * 
 */
package com.ssi.core.framework.web;

import com.ssi.core.framework.page.PageModel;

/**
 * 类说明：
 * @创建时间 Feb 22, 2011 12:23:59 PM
 * @创建人： Farley
 * @邮箱：kfy0521@163.com
 */

public class PageInfoUtil {
	
	public static void processPage(PageModel page) {
		int count = page.getTotalRecords();
		int totoalPage = 0;
		//计算总页�?
		totoalPage= count%page.getPageSize() > 0 ? count/page.getPageSize() + 1  : count/page.getPageSize();
		page.setTotalPage(totoalPage);
		//设置起始记录�?
		page.setStartRowPosition((page.getCurrentPage()-1) * page.getPageSize());
		int realRecords = page.getStartRowPosition() + page.getPageSize();
		//如果�?大限记录数小于真实记录数,则取�?大限记录�?
		realRecords = page.getMaxRecords() != 0 && page.getMaxRecords() < realRecords ? page.getMaxRecords() : realRecords; 
		//设置终止记录�?
		page.setEndRowPosition(realRecords);
	}

}
